package com.example.demo.controller;

import com.example.demo.common.R;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;

@ControllerAdvice
@RestController
public class ExceptionHandlerController {

    @ExceptionHandler
    public R error(Exception e){
        e.printStackTrace();
        return R.error(e.getMessage());
    }

}
